home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 2,801 to 2,900
/
aol-file-protocol-4400-2801-to-2900.zip
/
AOLDLs
/
C++ Files Library
/
LAboutBox (PP)
/
LAboutBox.sit
/
LAboutBox
/
LAboutBox.cp
< prev
next >
Wrap
Text File
|
1995-08-28
|
4KB
|
152 lines
// ===========================================================================
// LAboutBox.cp ⌐ 1995, âric Forget. All rights reserved.
// ===========================================================================
//
// ************************************************************************
// * *
// * Before using this code you should read the "License Agreement" *
// * document and agree with it. *
// * *
// ************************************************************************
//
// LAboutBox is a wrapper class to make life easier when implementing an
// about box.
//
// ---------------------------------------------------------------------------
//
// Instruction Notes:
// -----------------
//
// 1) Write a PPob resource with Constructor (or whatever you want!);
//
// 2) Write a RidL resource (even an empty one!) with the same ID as your PPob;
//
// 3) Call LAboutBox::DoAboutBox(), a static method.
//
// ---------------------------------------------------------------------------
#include "LAboutBox.h"
#include <UModalDialogs.h>
// ---------------------------------------------------------------------------
// Ñ DoAboutBox
// ---------------------------------------------------------------------------
void
LAboutBox::DoAboutBox(
ResIDT inResID)
{
StDialogHandler theHandler(inResID, LCommander::GetTopCommander());
LDialogBox *theDialog = (LDialogBox *)theHandler.GetDialog();
MessageT hitMessage = msg_Nothing;
theDialog->Show();
while (hitMessage == msg_Nothing) { // Let DialogHandler process events
hitMessage = theHandler.DoDialog();
}
}
// ---------------------------------------------------------------------------
// Ñ CreateAboutBoxStream [static]
// ---------------------------------------------------------------------------
// Return a new AboutBox object initialized using data from a Stream
LAboutBox*
LAboutBox::CreateAboutBoxStream(
LStream *inStream)
{
return (new LAboutBox(inStream));
}
// ---------------------------------------------------------------------------
// Ñ LAboutBox
// ---------------------------------------------------------------------------
// Default Constructor
LAboutBox::LAboutBox()
{
}
// ---------------------------------------------------------------------------
// Ñ LAboutBox(SWindowInfo&)
// ---------------------------------------------------------------------------
// Construct AboutBox from the data in a struct
LAboutBox::LAboutBox(
SWindowInfo &inWindowInfo)
: LDialogBox(inWindowInfo)
{
}
// ---------------------------------------------------------------------------
// Ñ LAboutBox(ResIDT, Uint32, LCommander*)
// ---------------------------------------------------------------------------
// Construct a AboutBox from a WIND Resource with the specified attributes
// and SuperCommander
//
// Side Effect: Created window becomes the current port
LAboutBox::LAboutBox(
ResIDT inWINDid,
Uint32 inAttributes,
LCommander *inSuper)
: LDialogBox(inWINDid, inAttributes, inSuper)
{
}
// ---------------------------------------------------------------------------
// Ñ LAboutBox(LStream*)
// ---------------------------------------------------------------------------
// Construct a AboutBox from the data in a Stream
LAboutBox::LAboutBox(
LStream *inStream)
: LDialogBox(inStream)
{
}
// ---------------------------------------------------------------------------
// Ñ HandleClick
// ---------------------------------------------------------------------------
// Respond to a click on a Window
//
// The inPart parameter is the part code returned by the Toolbox FindWindow
// routine.
void
LAboutBox::HandleClick(
const EventRecord &/*inMacEvent*/,
Int16 /*inPart*/)
{
mSuperCommander->AllowSubRemoval(this);
}
// ---------------------------------------------------------------------------
// Ñ HandleKeyPress
// ---------------------------------------------------------------------------
// DialogBox handles keyboard equivalents for hitting the Default and
// Cancel Buttons.
//
// Default Button: Enter, Return
// Cancel Button: Escape, Command-Period
Boolean
LAboutBox::HandleKeyPress(
const EventRecord &/*inKeyEvent*/)
{
return mSuperCommander->AllowSubRemoval(this);
}